package com.igoal.dto;

import java.util.List;

import com.igoal.entity.User;

public class PotentialFriendDTO extends BaseDTO<User> {
	private String username;
	private String avatar;
	private boolean isLoggined;
	private List<FriendDTO> mutualFriends;
	private int countMutualFriends;
	private boolean isFriend;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getAvatar() {
		return avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	public boolean isLoggined() {
		return isLoggined;
	}

	public void setLoggined(boolean isLoggined) {
		this.isLoggined = isLoggined;
	}

	public List<FriendDTO> getMutualFriends() {
		return mutualFriends;
	}

	public void setMutualFriends(List<FriendDTO> mutualFriends) {
		this.mutualFriends = mutualFriends;
	}

	public int getCountMutualFriends() {
		return countMutualFriends;
	}

	public void setCountMutualFriends(int countMutualFriends) {
		this.countMutualFriends = countMutualFriends;
	}

	public boolean isFriend() {
		return isFriend;
	}
	
	public boolean getFriend() {
		return isFriend;
	}

	public void setFriend(boolean isFriend) {
		this.isFriend = isFriend;
	}

	@Override
	public int hashCode() {
		return (username == null ? 13 : username.hashCode())
				+ (avatar == null ? 17 : avatar.hashCode());
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj instanceof PotentialFriendDTO) {
			PotentialFriendDTO po = (PotentialFriendDTO) obj;
			if (username == null && po.username == null && avatar == null
					&& po.avatar == null) {
				return true;
			}

			if (username != null && po.username != null
					&& username.equals(po.username) && avatar == null
					&& po.avatar == null) {
				return true;
			}

			if (username == null && po.username == null && avatar != null
					&& po.avatar != null && avatar.equals(po.avatar)) {
				return true;
			}

			if (username != null && po.username != null
					&& username.equals(po.username) && avatar != null
					&& po.avatar != null && avatar.equals(po.avatar)) {
				return true;
			}
		}
		return false;
	}
}
